package com.hfut.wxy.func;


import com.hfut.wxy.common.OkHttp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;

//@Configuration
public class UserVerify {
    @Autowired
    private OkHttp okHttp;

    @Scheduled(fixedDelay = 1000*60*60*24*20)//20天
    public void access_token(){
        okHttp.access_token();
    }

////    @Scheduled(fixedDelay = 3000)
//    public void main() throws IOException, InterruptedException {
//        if (!f) return;
//        driver.get(URL);
//        WebElement element = driver.findElementById("captchaImg");
//        File file = element.getScreenshotAs(OutputType.FILE);
//        FileUtils.copyFile(file,new File("imgs/img2.png"));
//        FileInputStream fis = new FileInputStream(file);
//        byte[] bytes = new byte[fis.available()];
//        int i = fis.read(bytes);
//        System.out.println(i);
//        fis.close();
//        BASE64Encoder base64Encoder = new BASE64Encoder();
//        String res = base64Encoder.encode(bytes);
//        res = URLEncoder.encode(res, "UTF-8");
//        JSONObject jsonObject = OkHttp.getVCode(Constants.access_token,res);
//        System.out.println(jsonObject);
//        System.out.println(jsonObject.getJSONArray("words_result").getJSONObject(0).getString("words"));
//        f = false;
//    }

}
